<?php


namespace app\common\model\system\merchant;


use app\common\model\BaseModel;

class Article extends BaseModel
{

    /**
     * @return string
     * @author: fupeng
     * @day: 2023/11/27
     */
    public static function tablePk(): string
    {
        return 'mer_article_id';
    }

    /**
     * @return string
     * @author: fupeng
     * @day: 2023/11/27
     */
    public static function tableName(): string
    {
        return 'merchant_article';
    }


    /**
     * @return \think\model\relation\HasOne
     */
    public function articleCategory()
    {
        return $this->hasOne(ArticleCategory::class ,'mer_article_category_id','cid')
            ->field('mer_article_category_id,title');
    }

    public function searchStatusAttr($query, $value)
    {
        $query->where('status', $value);
    }
}
